<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.prime.com.tr/ui">

    <h:head>
        <title>Supervisor - Add Agent</title>
        <link href="style.css" rel="stylesheet" type="text/css"></link>
        <div style="text-align: center;"><h:graphicImage url="/Images/back.png"></h:graphicImage></div>

    </h:head>
    <h:body>

        <div id="wrapper">
            <div id="logo">

            </div>
            <div id="header">
                <!-- 		<div id="menu">
                
                        </div>    -->
            </div>
            <div class="page">
                <div id="page-bgtop">

                    <div id="dummy"></div>
                    <p:panel id="panelsidebar" header="Pages Menu">
                        <ui:include src="MenuSupervisor.xhtml"/>
                    </p:panel>

                    <!-- end #sidebar -->

                    <div id="content">
                        <p:panel id="panel" header="Agent Information">
                            <h:form>
                                <h:panelGrid columns="2">

                                    <h:outputText value="Identity Number:"/>
                                    <p:inputMask mask="99999999999"  required="true" requiredMessage="Cannot be empty!" value="#{supervisorbean.agent.TC_ID}" />
                                    <h:outputText value="Name"/>
                                    <p:inputText  required="true" requiredMessage="Cannot be empty!" value="#{supervisorbean.agent.name}"></p:inputText>
                                    <h:outputText value="Surname"/>
                                    <p:inputText  required="true" requiredMessage="Cannot be empty!" value="#{supervisorbean.agent.surname}"></p:inputText>
                                    <h:outputText value="Mobile Number:" />
                                    <p:inputMask  mask="(999)999-99-99" required="true" requiredMessage="Cannot be empty!" value="#{supervisorbean.agent.gsmNumber}"/>
                                    <h:outputText value="E-Mail:" />
                                    <p:inputText value="#{supervisorbean.agent.eMail}"/>
                                    <h:outputText value="Birth Date:" />
                                    <p:calendar mode="popup" value="#{supervisorbean.agent.birthDate}" />
                                    <h:selectOneMenu id="city" value="#{supervisorbean.city}">
                                        <f:selectItem itemLabel="Select City" itemValue="" />
                                        <f:selectItems value="#{supervisorbean.cities}" />
                                        <p:ajax update="suburbs" 
                                                listener="#{supervisorbean.handleCityChange}" />
                                    </h:selectOneMenu>

                                    <h:selectOneMenu id="suburbs" value="#{supervisorbean.suburb}" >
                                        <f:selectItem itemLabel="Select Suburb" itemValue="" />
                                        <f:selectItems value="#{supervisorbean.suburbs}" />
                                    </h:selectOneMenu>
                                    <h:outputText value="Address:"  />
                                    <p:inputTextarea style="width:300px;height:100px;" effectDuration="400" value="#{supervisorbean.agent.addressResume}"/>

                                    <p:commandButton value="Save" update="panel" action="#{supervisorbean.addAgent}"></p:commandButton> 	
                                    <p:commandButton value="Reset"></p:commandButton> 

                                </h:panelGrid>

                                <p:messages/>
                            </h:form>
                        </p:panel>  

                    </div>
                    <!-- end #content -->

                    <div style="clear: both;">&nbsp;</div>
                </div>

                <!-- end #page -->

            </div>
            <div id="footer-bgcontent">
                <div id="footer" align="center">
                    <p>İstanbul Teknik Üniversitesi - Software Engineering Course - Real Estate Management</p>
                </div>
            </div>
            <!-- end #footer -->
        </div>


    </h:body>
</html>